<template>
  <main>
    <div class="title">我的首页</div>
    <header>
      <li>全部售后</li>
      <li>申请退款</li>
      <li>拒绝退款</li>
      <li>退款完成</li>
    </header>
    <el-row :gutter="0" style="margin: 0">
      <el-col v-for="(item, index) in list" :key="index" :span="item.num"
        ><div class="grid-content bg-purple">{{ item.title }}</div></el-col
      >
    </el-row>
    <section>
      <ul>
        <li v-for="(item, index) in shouhoulist" :key="index">
          <div>
            <img src="@/assets/imgs/19.png" alt="" />
            <p>{{ item.goodsClass }}</p>
          </div>
          <p>退单号:202112237865748 订单号:202112207865748</p>
          <span>{{ item.goodsSale }}</span>
          <span>2021-12-21 17:34:22</span>
          <span :style="{ color: item.color }">待处理</span>
          <span>部分金额退款</span>
          <span>查看</span>
        </li>
      </ul>
    </section>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="numall"
      v-model="currentPage"
      @currentChange="fn"
      :pageSize="pageSize"
    >
    </el-pagination>
  </main>
</template>
<script>
import { mockapi } from "../../../api/shouhou/mock";
export default {
  data() {
    return {
      shouhoulist: "",
      numall: "",
      currentPage: 1,
      pageSize: 8,
    };
  },
  created() {
    this.getshouhouapi();
  },
  // watch: {
  //   currentPage(val) {
  //     console.log(val);
  //     this.currentPage = val;
  //   },
  // },
  methods: {
    fn(a) {
      this.currentPage = a;
      console.log(this.currentPage);
      this.getshouhouapi();
    },
    async getshouhouapi() {
      const res = await mockapi.getshouhoulist(this.currentPage, this.pageSize);
      this.shouhoulist = res.result;
      console.log(this.shouhoulist);
      const res1 = await mockapi.getshouhoulist1();
      console.log(res1);
      this.numall = res1.result.data.length;
    },
  },
};
</script>

<style lang="less" scoped>
@import "../../../assets/css/var.less";
main {
  background: #fff;
}
.title {
  width: 100%;
  height: 40px;
  line-height: 40px;
  font-weight: 800;
  font-size: 16px;
  background: #fff;
  border-bottom: 1px solid #e9e9e9;
}
header {
  display: flex;
  width: 100%;
  align-items: center;
  height: 50px;
  li {
    width: 100px;
    height: 30px;
    .center();
    background: #f5f5f5;
    margin-left: 20px;
    &:first-of-type {
      color: #fff;
      background: @theme1-color;
    }
  }
}
.bg-purple {
  background: #f5f5f5;
}
.el-row {
  background: #f5f5f5;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
  display: flex;
  align-items: center;
}

section {
  background: #fff;
  height: 100%;
  ul {
    width: 100%;
    li {
      display: flex;
      height: 60px;
      align-items: center;
      div {
        display: flex;
        align-items: center;
        width: 20.8%;
        justify-content: space-between;
        p {
          margin-right: 10px;
        }
      }
      img {
        width: 136px;
        height: 40px;
      }
      > p {
        height: 60px;
        display: flex;
        align-items: center;
        width: 17%;
      }
      span {
        &:nth-of-type(1) {
          width: 12.5%;
        }
        &:nth-of-type(2) {
          width: 16.7%;
        }
        &:nth-of-type(3) {
          width: 12.5%;
          color: red;
        }
        &:nth-of-type(4) {
          width: 12.5%;
        }
        &:nth-of-type(5) {
          color: @theme1-color;
        }
      }
    }
  }
}
.el-pagination {
  display: flex;
  justify-content: center;
}
</style>
